package com.shijiezhijia.sjzjapp.anntations;

/**
 * @Author tzc
 * @Time 2022/11/19 0019
 * Describe 绑定实现类 初始化实现该类。
 */
public class BindUtils {

    public static final void bind(Object target) {
        //com.shijiezhijia.sjzjapp.demo.MainActivity_ViewBinding 通过注解处理器生成
        String name=target.getClass().getName()+"_ViewBinding";
        try {
            Class<?> c=Class.forName(name);
            IBinder iBinder= (IBinder) c.newInstance();
            //执行绑定操作，将控件绑定
            iBinder.bind(target);
        } catch (ClassNotFoundException e) {
            e.printStackTrace();
        } catch (IllegalAccessException e) {
            e.printStackTrace();
        } catch (InstantiationException e) {
            e.printStackTrace();
        }
    }
}
